package by.abolut.carpool.service.impl;

import by.abolut.carpool.dao.RequesterDAO;
import by.abolut.carpool.domain.Requester;
import by.abolut.carpool.domain.User;
import by.abolut.carpool.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Andrey on 06.10.2014.
 */

@Service
public class UserService implements IUserService {

    @Autowired
    private RequesterDAO requesterDAO;


    @Override
    public User getUserByLogin(String login) {
        System.out.println(login);
        return null;
    }

    @Override
    public User saveUser(User user) {
        if (user instanceof Requester) {
            saveRequester((Requester) user);
        }
        return null;
    }

    private void saveRequester(Requester requester) {
        requesterDAO.create(requester);
    }
}
